import io.*;
public class IDMaker
{

  private boolean openedOkay;
  private int nowID, nextID, initialValue;
  
  public void IDMaker (String inFileName)
  {
   TextFile inputFile;
    inputFile = new TextFile(inFileName+".txt", "r");
    openedOkay = inputFile.openFile();
    System.out.println(openedOkay);
    inputFile.rewind();
    nowID = inputFile.readInt();
    inputFile.closeFile();
    
    
    
    TextFile outputFile;
    outputFile = new TextFile( inFileName+".txt", "w");
    openedOkay = outputFile.openFile();
    outputFile.rewind();
  if (nowID > 999 && nowID < 10000)
    {
      nextID = nowID+1;
    } else {
      nextID = 1000;
        System.out.println("LogFile is Full! Make a new one! - program will exit");
        System.exit(0);
    }
     outputFile.printIt(nextID);
      
      
      outputFile.closeFile();
      }
  public int getNewID()
  {
   return nextID;
  }
  public void makeNewID(String inNewFileName)
  {
	TextFile outputFile;
	int initialValue = 1000;
    outputFile = new TextFile( inNewFileName+".txt", "w");
    openedOkay = outputFile.openFile();
    outputFile.rewind();
	outputFile.printIt(initialValue);
	outputFile.closeFile();
	}
  public int getNowID()
  {
    return nowID;
  }
  }